// 导入需要的config和request
import confing from '../config/config.js';
import request from '../util/request.js';

// 申明请求对象
const routeProcessRequest = {
  // dict请求的基本url
  BASE_URL: confing.PRO_URL + "/routeProcess",
  /**
   * 根据工艺流程编号查询组成工序
   * @param {*} routeId 
   * @param {*} callback 
   */
  list(routeId, callback) {
    request.get(this.BASE_URL + "/list?routeId=" + routeId, callback);
  },
  /**
   * 
   * @param {*} routeProcess 
   * @param {*} callbcak 
   */
  save(routeProcess, callbcak) {
    if (routeProcess) {
      request.post(this.BASE_URL + "/save", routeProcess, callbcak);
    }
  },
  /**
   * 通过id查询工艺组成信息
   * @param {*} recordId 
   * @param {*} callback 
   */
  get(recordId, callback) {
    if (recordId) {
      let url = this.BASE_URL + "/get?recordId=" + recordId;
      request.get(url, callback);
    }
  },
   /**
    * 根据ID编辑工艺组成信息
    * @param {} routeProcess 
    * @param {*} callback 
    */
   edit(routeProcess, callback) {
    if (routeProcess != undefined && routeProcess.recordId != undefined) {
      request.put(this.BASE_URL + "/update", routeProcess, callback);
    }
  },
  /**
   * 根据ID删除工艺组成
   * @param {*} recordId 
   * @param {*} callback 
   */
  delete(recordId, callback) {
    request.delete(this.BASE_URL + "/delete?recordId=" + recordId, callback);
  },

}
// 将dictRequest暴漏出去
export default routeProcessRequest;